Skip to content

Allow @variant to be used inside addBase#19480

Merged
RobinMalfait merged 4 commits into
mainfrom
fix/at-variant-inside-add-base
Jun 4, 2026
Merged

Allow @variant to be used inside addBase#19480
RobinMalfait merged 4 commits into
mainfrom
fix/at-variant-inside-add-base

Conversation

@thecrypticace
Copy link
Copy Markdown
Contributor

This seems like an unintentional omission

@RobinMalfait RobinMalfait force-pushed the fix/at-variant-inside-add-base branch from e6d54ab to 2b60ac9 Compare June 4, 2026 10:39
@RobinMalfait RobinMalfait marked this pull request as ready for review June 4, 2026 10:42
@RobinMalfait RobinMalfait requested a review from a team as a code owner June 4, 2026 10:42
@RobinMalfait RobinMalfait enabled auto-merge (squash) June 4, 2026 10:42
Copy link
Copy Markdown
Member

@RobinMalfait RobinMalfait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this makes sense, we already handle @apply and we also handle @variant in the other JS based APIs.

Thanks!

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Jun 4, 2026

Confidence Score: 5/5

Safe to merge. The change is minimal and targeted, mirrors the pattern used in the main compilation path, and is backed by an inline snapshot test.

The diff is a single extra line adding substituteAtVariant to the addBase pipeline, identical to how it is used in index.ts and design-system.ts. The return value is correctly OR'd into featuresRef.current. The new test validates both a media-query breakpoint variant and a compound/comma-separated selector variant, covering the main code paths in substituteAtVariant.

No files require special attention.

Reviews (1): Last reviewed commit: "update changelog" | Re-trigger Greptile

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 4, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d541b6f2-eef6-4bb9-9071-e2106bf20aac

📥 Commits

Reviewing files that changed from the base of the PR and between d42b34a and 30bd46c.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • packages/tailwindcss/src/compat/plugin-api.test.ts
  • packages/tailwindcss/src/compat/plugin-api.ts

Walkthrough

This PR adds support for using @variant directives inside the addBase() plugin API. The implementation imports the substituteAtVariant helper function and applies it within the base AST processing flow in addBase(). A comprehensive test verifies that nested @variant directives are correctly transformed into equivalent media queries and selector rules, while the changelog documents the new capability.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the main change: enabling the @variant directive to work inside addBase, which directly matches the changeset modifications.
Description check ✅ Passed The description is minimal but directly relevant to the changeset, indicating this was an unintentional omission that the PR fixes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@RobinMalfait RobinMalfait merged commit ad66939 into main Jun 4, 2026
8 checks passed
@RobinMalfait RobinMalfait deleted the fix/at-variant-inside-add-base branch June 4, 2026 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants